| print("*****LIST*****") |
| index = arr[index][1] |
| while (index != -1): |
| while (index != -1): |
| print(str(index) + ": " + str(arr[index])) |
| print(str(index) + ": " + str(arr[index])) |
| print("Start: " + str(start)) |
| print("NextFree: " + str(nextfree)) |
| def printOrder(linklist): |
| index = start |
| index = nextfree |
| index = arr[index][1] |
| print("*****FREES*****") |
|     print("*****LIST*****") |
|         index = arr[index][1] |
|     while (index != -1): |
|     while (index != -1): |
|         print(str(index) + ": " + str(arr[index])) |
|         print(str(index) + ": " + str(arr[index])) |
|     print("Start: " + str(start)) |
|     print("NextFree: " + str(nextfree)) |
| def printOrder(linklist): |
|     index = start |
|     index = nextfree |
|         index = arr[index][1] |
|     print("*****FREES*****") |
| 1 | def printOrder(linklist): |
| 2 |     print("*****LIST*****") |
| 3 |     index = start |
| 4 |     while (index != -1): |
| 5 |         print(str(index) + ": " + str(arr[index])) |
| 6 |         index = arr[index][1] |
| 7 |          |
| 8 |     print("*****FREES*****") |
| 9 |     index = nextfree |
| 10 |     while (index != -1): |
| 11 |         print(str(index) + ": " + str(arr[index])) |
| 12 |         index = arr[index][1] |
| 13 |     print("Start: " + str(start)) |
| 14 |     print("NextFree: " + str(nextfree)) |
| if previous_index == -1: |
| linklist[index][1] = nextfree |
| removeItem(linkedlist, "robin") |
| start = linklist[index][1] |
| if linklist[index][0] == string: |
| previous_index = index |
| while (index != -1): |
| printOrder(linkedlist) |
| index = start |
| previous_index = -1 |
| linklist[previous_index][1] = linklist[index][1] |
| else: |
| break |
| def removeItem(linklist, string): |
| printOrder(linkedlist) |
| index = linklist[index][1] |
| nextfree = index |
|     if previous_index == -1: |
|     linklist[index][1] = nextfree |
| removeItem(linkedlist, "robin") |
|         start = linklist[index][1] |
|         if linklist[index][0] == string: |
|         previous_index = index |
|     while (index != -1): |
| printOrder(linkedlist) |
|     index = start |
|     previous_index = -1 |
|         linklist[previous_index][1] = linklist[index][1] |
|     else: |
|             break |
| def removeItem(linklist, string): |
| printOrder(linkedlist) |
|         index = linklist[index][1] |
|     nextfree = index |
| 1 | def removeItem(linklist, string): |
| 2 |     index = start |
| 3 |     previous_index = -1 |
| 4 |     while (index != -1): |
| 5 |         if linklist[index][0] == string: |
| 6 |             break |
| 7 |         previous_index = index |
| 8 |         index = linklist[index][1] |
| 9 |     if previous_index == -1: |
| 10 |         start = linklist[index][1] |
| 11 |     else: |
| 12 |         linklist[previous_index][1] = linklist[index][1] |
| 13 |     linklist[index][1] = nextfree |
| 14 |     nextfree = index |
| 15 | |
| 16 | printOrder(linkedlist) |
| 17 | removeItem(linkedlist, "robin") |
| 18 | printOrder(linkedlist) |
| return |
| def addItem(linklist,string): |
| break |
| while (index != -1): |
| nextfree = linklist[newLocation][1] |
| start = newLocation |
| lastindex = -1 |
| linklist[newLocation][0] = string |
| if lastindex == -1: |
| newLocation = nextfree |
| linklist[lastindex][1] = newLocation |
| index = linklist[index][1] |
| lastindex = index |
| if linklist[index][0] > string: |
| linklist[newLocation][1] = index |
| index = start |
|         return |
| def addItem(linklist,string): |
|             break |
|     while (index != -1): |
|     nextfree = linklist[newLocation][1] |
|         start = newLocation |
|     lastindex = -1 |
|     linklist[newLocation][0] = string |
|     if lastindex == -1: |
|     newLocation = nextfree |
|     linklist[lastindex][1] = newLocation |
|         index = linklist[index][1] |
|         lastindex = index |
|         if linklist[index][0] > string: |
|     linklist[newLocation][1] = index |
|     index = start |
| 1 | def addItem(linklist,string): |
| 2 |     newLocation = nextfree |
| 3 |     linklist[newLocation][0] = string |
| 4 |     nextfree = linklist[newLocation][1] |
| 5 |     index = start |
| 6 |     lastindex = -1 |
| 7 |     while (index != -1): |
| 8 |         if linklist[index][0] > string: |
| 9 |             break |
| 10 |         lastindex = index |
| 11 |         index = linklist[index][1] |
| 12 |     linklist[newLocation][1] = index |
| 13 |     if lastindex == -1: |
| 14 |         start = newLocation |
| 15 |         return |
| 16 |     linklist[lastindex][1] = newLocation |
| newlinkedlist = createLinkedList(10) |
| llist["linklist"].append([None,-1]) |
| llist = {"linklist":[],"start": -1, "nextfree": 0} |
| for x in range(size-1): |
| def createLinkedList(size): |
| llist["linklist"].append([None,x+1]) |
| return llist |
| newlinkedlist = createLinkedList(10) |
|     llist["linklist"].append([None,-1]) |
|     llist = {"linklist":[],"start": -1, "nextfree": 0} |
|     for x in range(size-1): |
| def createLinkedList(size): |
|         llist["linklist"].append([None,x+1]) |
|     return llist |
| 1 | def createLinkedList(size): |
| 2 |     llist = {"linklist":[],"start": -1, "nextfree": 0} |
| 3 |     for x in range(size-1): |
| 4 |         llist["linklist"].append([None,x+1]) |
| 5 |     llist["linklist"].append([None,-1]) |
| 6 |     return llist |
| 7 | |
| 8 | newlinkedlist = createLinkedList(10) |